package com.example.x.helpmeget2;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class TwoFragment extends Fragment implements View.OnClickListener {

    @Nullable

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View rootView = inflater.inflate(R.layout.frame_two, container, false);
       // rootView.findViewById(R.id.chat).setOnClickListener(this);
        rootView.findViewById(R.id.order_rec).setOnClickListener(this);
        return rootView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);


    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.chat:
//
//                final String APP_KEY = "23332462";
//                final String userid = "test2";
//                YWIMKit mIMKit = YWAPI.getIMKitInstance(userid, APP_KEY);

//                //userid是客服帐号，第一个参数是客 服帐号，第二个是组ID，如果没有，传0
//                EServiceContact contact = new EServiceContact(userid, 0);
////如果需要发给指定的客服帐号，不需要Server进行分流(默认Server会分流)，请调用EServiceContact对象
////的setNeedByPass方法，参数为false。
////contact.setNeedByPass(false);
//                Intent intent = mIMKit.getChattingActivityIntent(contact);
//                startActivity(intent);

//                final String appkey = "23332462";
//                final String target = "test1";
//                startActivity(MainActivity.mIMKit.getChattingActivityIntent(target, appkey));
                break;

            case R.id.order_rec:
                startActivity(new Intent(getContext(),order_rec.class));
                break;
        }
    }
}